replaceChild

abstract fun replaceChild(newNode: Node, oldNode: Node): Boolean

Replaces the given child oldNode of the current node with the given newNode. The new node can be an existing node in the document, or you can create and insert a new node. If the newNode is existing node, it will be moved to a new location in the document.

Return

true if the given oldNode was successfully replaced

Parameters

newNode

the new node to replace the oldNode

oldNode

the existing node to be replaced

Throws

when this node is closed